﻿using System.Collections.Generic;
using ElevatorApplication.Extensions;

namespace ElevatorApplication
{
    public class Elevator : IElevator
    {
        public int CurrentFloorNumber { get; private set; }
        
        public int FloorHeight { get { return 20; } }

        public IElevatorState ElevatorState { get; private set; }

        public List<ButtonsOfFloor> ButtonStateInFloors { get; private set; }

        public Elevator()
        {
            CurrentFloorNumber = 1;
            ButtonStateInFloors = FloorHeight.Create();
            ElevatorState=new StoppedState(this);
        }

        public void PushUpButton(int floorNumber)
        {
            ButtonStateInFloors.For(floorNumber).PushUpButton();
        }

        public void PushDownButton(int floorNumber)
        {
             ButtonStateInFloors.For(floorNumber).PushDownButton();
        }

        public void PubshNumberButton(int floorNumber)
        {
             ButtonStateInFloors.For(floorNumber).PushNumberButton();
        }

        public void Start()
        {
            ElevatorState.Running();
        }

        public void ChangeSate(IElevatorState newState)
        {
            ElevatorState = newState;
            ElevatorState.Running();
        }

        public void SetCurrentFloorNumber(int floorNumber)
        {
            CurrentFloorNumber = floorNumber;
        }
   
    }

}
